package com.lovo.controller;

import com.lovo.entity.UserEntity;
import com.lovo.token.SysToken;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("boot")
@Api(tags = "登录")
public class LoginController {

    @ApiOperation(value = "登录系统返回token")
    @PostMapping("login")
    public String login(UserEntity user) {
        if (user.getUserName().equals("zy") && user.getPassword().equals("123456")) {
            return SysToken.createToken("/boot/power1/boot/power2/");
        }
        return "";
    }

    @GetMapping("power1")
    public String power1() {
        return "权限1";
    }

    @GetMapping("power2")
    public String power2() {
        return "权限2";
    }

    @GetMapping("power3")
    public String power3() {
        return "权限3";
    }
}
